<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 函数写阶乘 -->
</head>
<body>
  <script>
var n = parseInt(prompt("请输入一个整数"));
var sum = 1;
for (var i = n; i >0; i--) {
	sum *= i
}
alert("n的阶乘为" + sum);
  </script>
</body>
</html>